﻿using Api.WDS.Methods;
using DBModels;
using Method.Token;
using Models.operResult;
using RedisHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Api.WDS.Operate
{
    public class LogInOp
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="uid">用户编号</param>
        /// <param name="pwd">用户密码</param>
        /// <param name="sessionId">会话编号</param>
        /// <returns></returns>
        public OperResult<string> UserLogIn(string uid, string pwd, string sessionId)
        {
            if (uid is null || pwd is null)
                return OperResult<string>.Failed("请输入用户名或密码");
            if (!int.TryParse(uid, out int i))
                return OperResult<string>.Failed("请输入正确的账号");
            //查询用户账号密码是否正确
            return new LogInMet().UserLogIn(uid, pwd, sessionId);
        }
    }
}
